home *** CD-ROM | disk | FTP | other *** search
/ BBS in a Box 7 / BBS in a Box - Macintosh - Volume VII (BBS in a Box) (January 1993).iso / Files / Prog / T / TC Prog Guide.cpt / picture ƒ / simpict.c < prev    next >
C/C++ Source or Header  |  1991-02-27  |  2KB  |  98 lines

  1. /*
  2. *    FILE:        simpict.c
  3. *    AUTHOR:        R. Gonzalez
  4. *    CREATED:    October 4, 1990
  5. *
  6. *    Test simple pict application.  Includes main() function.
  7. *
  8. *    ASSOCIATED FILES:
  9. *        simpict.h,class.c,class.h,screen.c,screen.h,coord.c,coord.h,
  10. *        frame.c,frame.h,color.h,error.c,error.h,trans.h,oops.h,
  11. *        pict.c,pict.h,project.c,project.h,backdrop.c,backdrop.h,
  12. *        several ANSI and Macintosh headers
  13. *
  14. *    PROJECT CONTENTS (Think C):
  15. *        above-listed source (.c) files, MacTraps, ANSI or ANSI-881,
  16. *        oops library.
  17. *
  18. *    COMPILATION (Think C):
  19. *        68881 code generation if ANSI-881 is used.
  20. */
  21.  
  22. # include    "simpict.h"
  23.  
  24. /******************************************************************
  25. *    initialize
  26. ******************************************************************/
  27. boolean    Simple_Pict::init(void)
  28. {
  29.     Generic_Pict::init();
  30.     
  31.     projector1 = new(Projector);
  32.     projector1->init();
  33.     projector1->set_cropping_frame(5.,5.,10.,10.);
  34.     projector1->set_projection_frame(0.,0.,1.,1.);
  35.     projector1->set_background_color(CYAN);
  36.     projector1->set_screen(screen);
  37.  
  38.     projector2 = new(Corner_Projector);
  39.     projector2->init();
  40.     projector2->set_cropping_frame(5.,5.,10.,10.);
  41.     projector2->set_screen(screen);
  42.     
  43.     c1 = new(Coord2);
  44.     c1->init();
  45.     c2 = new(Coord2);
  46.     c2->init();
  47.     
  48.     return TRUE;
  49. }
  50.  
  51. /******************************************************************
  52. *    run
  53. ******************************************************************/
  54. void    Simple_Pict::run(void)
  55. {
  56.     c1->set(1.,1.);
  57.     c2->set(9.,9.);
  58.     
  59.     projector1->show_line(c1,c2,RED);
  60.     projector2->show_line(c1,c2,BLUE);
  61.     
  62.     screen->wait();
  63. }
  64.  
  65. /******************************************************************
  66. *    destroy
  67. ******************************************************************/
  68. boolean    Simple_Pict::destroy(void)
  69. {
  70.     c1->destroy();
  71.     delete(c1);
  72.     c2->destroy();
  73.     delete(c2);
  74.     
  75.     projector1->destroy();
  76.     delete(projector1);
  77.     projector2->destroy();
  78.     delete(projector2);
  79.  
  80.     return Generic_Pict::destroy();
  81. }
  82.  
  83. /******************************************************************
  84. *    main function
  85. ******************************************************************/
  86. main()
  87. {
  88.     Generic_Pict    *pict;
  89.     
  90.     pict = new(Simple_Pict);
  91.     pict->init();
  92.     pict->run();
  93.     pict->destroy();
  94.     delete(pict);
  95. }
  96.  
  97.     
  98.